const app = getApp();
Page({
  data: {
    orderHeader:null,
    orderDetail:null,
    userType: '0'
  },
  onLoad: function (options){
    console.log(options.orderSn);
    var that = this;
    var orderSn = options.orderSn;
    wx.request({
      url:   getApp().globalData.server_support + "/collect-scrap/queryOrderInfo",
      data: orderSn,
      method: 'POST',
      header: {
        'token': getApp().globalData.token
      },
      success: function (res) {
        console.log(res.data);
        if (res.data.success) {
          that.setData({
            orderHeader: res.data.data,
            orderDetail: res.data.data.detaiList,
            userType:app.globalData.userType
          })
        } else {
          console.log("接单失败")
        }

      },
      fail: function (res) {

      }
    })
  },
  doPhone: function (e) {
    var phone = e.currentTarget.dataset.phone
    wx.makePhoneCall({
      phoneNumber: phone, //此号码并非真实电话号码，仅用于测试  
      success: function () {
        console.log("拨打电话成功！")
      },
      fail: function () {
        console.log("拨打电话失败！")
      }
    })
  },
  onShow:function(){
    wx.setNavigationBarTitle({
      title: '三轮兄弟'
    })
  }
});